'''
Created on May 31, 2012

@author: mupet
'''
from syslogd.log.Stats import Stats
from threading import Thread
import time

class StatsTabListener(object):
    '''
    classdocs
    '''
    
    class StatsUpdater(Thread):
        
        
        def __init__(self, statsList):
            Thread.__init__(self)
            self.statsList=statsList
        
        def run(self):
            while 1:
                self.statsList.Clear()
                self.statsList.Append(Stats.getInstance().getStats())
                #print(Stats.getInstance().getStats())
                time.sleep(5)
            
        

    def __init__(self):
        '''
        Constructor
        '''
        self.statsList = None
        
    def setStatsList(self, statsList):
        self.statsList = statsList
        self.StatsUpdater(statsList).start()